﻿@model DHQGHN.PM2.Models.Online.HouseHoldDetailPartialViewModel

<script>
      @functions{
          public string GetAntiForgeryToken()
          {
              string cookieToken, formToken;
              AntiForgery.GetTokens(null, out cookieToken, out formToken);
              return cookieToken + "," + formToken;
          }
      }
    function ClickButtonNext(isback) {
        $('form').validate({
        });
        if (!$('form').valid()) {
            return;
        };
        //validate data
        var dataSend = {
            'HOUSEHOLD_ID': $('#HOUSEHOLD_ID').val(),
            'HOUSEHOLD_CODE': $('#HOUSEHOLD_CODE').val(),
            'HOUSEHOLD_NUMBER': $('#HOUSEHOLD_NUMBER').val(),
            'HOUSEHOLD_NAME': $('#HOUSEHOLD_NAME').val(),
            'NUM_OF_HH_MEMBER': $('#NUM_OF_HH_MEMBER').val(),
            'ONLINE_SURVEY_STATUS': $('#ONLINE_SURVEY_STATUS').val(),
            'AREA_ID': $('#AREA_ID').val(),
            'AREA_NAME': $('#AREA_NAME').val(),
            'ADDRESS_ID': $('#ADDRESS_ID').val(),
            'HH_HEAD_MOBILE': $('#HH_HEAD_MOBILE').val(),
            'HH_HEAD_EMAIL': $('#HH_HEAD_EMAIL').val(),
            'ADDRESS_NAME': $('#ADDRESS_NAME').val(),
            'IsBack': isback
        };
        $("#divLoading").show();
        $('#btnNext').attr('disabled', true);
        var jqXHR = $.ajax({
            url: '@Url.Action("HouseKhaiOnline", "Online")',
            dataType: 'html',
            method: 'post',
            cache: false,
            headers: {
                'VerificationToken': '@GetAntiForgeryToken()'
            },
            
            data: dataSend,
            success: function (data, textStatus, jqXHR) {
                $('#formLogin').html(data);
                $("#divLoading").hide();
                $('#btnNext').removeAttr('disabled');

            },
            error: function (jqXHR, textStatus, errorThrown) {
                $("#divLoading").hide();
                $('#btnNext').removeAttr('disabled');
                alert('Có lỗi xảy ra trong quá trình đăng nhập: ' + errorThrown);
            }

        });
    };
    $(document).ready(function () {
        $('#btnSaveandLogout').css("visibility", "visible");
        $("#btnNext").click(function (event, giatri) {
            if (checkhtml()) {
                alert("Dữ liệu nhập không được có ký tự '<' ở đầu.");
            } else {
                if (giatri != null) {
                    ClickButtonNext(giatri);
                }
                else {
                    ClickButtonNext("");
                }
            }
        });
    });
</script>

<div class="noidung" id="divLoadPartial">
    <div class="login-fields1">
        <p style="float: left; padding-right: 5px; vertical-align: top;">
            <img src="../Images/rt_arrow.gif">
        <p>Thông tin về hộ gia đình.</p>
    </div>
    <br />
    @Html.AntiForgeryToken()
    @Html.HiddenFor(m => m.HOUSEHOLD_CODE)
    @Html.HiddenFor(m => m.HOUSEHOLD_ID)
    @Html.HiddenFor(m => m.HOUSEHOLD_NUMBER)
    <div class="row row-online-table">
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.HOUSEHOLD_NAME, new { @class = "control-lable" }) <span class="text-danger">*</span>
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.HOUSEHOLD_NAME, new { @class = "form-control", @maxlength = 255 })
        </div>
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.NUM_OF_HH_MEMBER, new { @class = "control-lable" }) <span class="text-danger">*</span>
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.NUM_OF_HH_MEMBER, new { @class = "form-control", @type = "number"})
        </div>
    </div>
    <div class="row row-online-table">
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.ONLINE_SURVEY_STATUS, new { @class = "control-lable" })
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.ONLINE_SURVEY_STATUS, new { @class = "form-control", @readOnly = true })
        </div>
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.HH_HEAD_MOBILE, new { @class = "control-lable" })
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.HH_HEAD_MOBILE, new { @class = "form-control", @maxlength = 14 })
        </div>
    </div>
    <div class="row row-online-table">
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.HH_HEAD_EMAIL, new { @class = "control-lable" })
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.HH_HEAD_EMAIL, new { @class = "form-control", @maxlength = 100 })
        </div>
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.AREA_NAME, new { @class = "control-lable" })
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.AREA_NAME, new { @class = "form-control", @readOnly = true })
        </div>
    </div>
    <div class="row row-online-table">
        <div class="col-md-3 lbl-online">
            @Html.LabelFor(m => m.ADDRESS_NAME, new { @class = "control-lable" })
        </div>
        <div class="col-md-3">
            @Html.TextBoxFor(m => m.ADDRESS_NAME, new { @class = "form-control", @maxlength = 255 })
            @*@Html.DisplayFor(m => m.AREA_NAME)*@
        </div>
        @*<div class="col-md-3 lbl-online">

            </div>
            <div class="col-md-3">


            </div>*@
    </div>
    <div class="row row-online-table">
        @*<div class="col-md-3 text-danger" id="message">

            </div>*@
        <div class="col-md-12 text-danger">
            @Html.ValidationSummary()
        </div>

    </div>
    <center>
        @*<button type="button" id="btnNext" class="btn btn-small btn-small_online btn-success buttonClick" onclick="ClickButtonNext()">Tiếp tục >></button>*@
        <input type="button" id="btnNext" class="btn btn-small btn-small_online btn-success buttonClick" value="Tiếp tục >>">
    </center>

</div>
